<?php

/**
 * @Author: wuchenge
 * @Date: 2020-11-30 16:50:41
 * @email: ligui0506@sina.com
 * @descript: 验证失败返回
 */

namespace App\Exceptions;

use App\Http\Controllers\ApiController;
use Exception;
use Illuminate\Http\Request;

class ApiHandler extends Exception
{
    public function __construct(int $code = 400, string $message = "")
    {
        parent::__construct($message, $code);
    }

    public function render()
    {
        $api = new ApiController;
        return $api->setErrorCode($this->code, $this->message)->response();
    }
}
